{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b978e811",
   "metadata": {},
   "outputs": [],
   "source": [
    "import akshare as ak\n",
    "from mysharelib.tools import normalize_symbol\n",
    "from core.config import config\n",
    "from fin_data.profile import get_quote, get_price\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a16bb9c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "data=get_quote(\"06823,600104\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "08bff007",
   "metadata": {},
   "outputs": [],
   "source": [
    "# For pandas DataFrame - in-place modification\n",
    "data = get_price(\"06823\")\n",
    "#data.set_index('item', inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "b6c55f5c",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.set_index('item', inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "97d31d76",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.loc[[\"代码\"]]=\"06823.HK\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "e8cac02a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>value</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>item</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>代码</th>\n",
       "      <td>06823.HK</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52周最高</th>\n",
       "      <td>12.95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>流通股</th>\n",
       "      <td>7579776147</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>最高</th>\n",
       "      <td>11.78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>流通值</th>\n",
       "      <td>88986571966.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>最小交易单位</th>\n",
       "      <td>1000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>涨跌</th>\n",
       "      <td>0.12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每股收益</th>\n",
       "      <td>0.6794</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>昨收</th>\n",
       "      <td>11.62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>成交量</th>\n",
       "      <td>3184849</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>周转率</th>\n",
       "      <td>0.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52周最低</th>\n",
       "      <td>9.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>名称</th>\n",
       "      <td>香港电讯-SS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>交易所</th>\n",
       "      <td>HK</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市盈率(动)</th>\n",
       "      <td>21.4943</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>基金份额/总股本</th>\n",
       "      <td>7579776147</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>均价</th>\n",
       "      <td>11.7239</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>涨幅</th>\n",
       "      <td>1.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市销率</th>\n",
       "      <td>2.568</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>振幅</th>\n",
       "      <td>1.72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>现价</th>\n",
       "      <td>11.74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>今年以来涨幅</th>\n",
       "      <td>30.82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>发行日期</th>\n",
       "      <td>2011-11-29 00:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>最低</th>\n",
       "      <td>11.58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>资产净值/总市值</th>\n",
       "      <td>88986571966.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>股息(TTM)</th>\n",
       "      <td>0.797</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>股息率(TTM)</th>\n",
       "      <td>6.79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>货币</th>\n",
       "      <td>HKD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每股净资产</th>\n",
       "      <td>4.7895</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市盈率(静)</th>\n",
       "      <td>17.5516</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>成交额</th>\n",
       "      <td>37328296.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市净率</th>\n",
       "      <td>2.4512</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市盈率(TTM)</th>\n",
       "      <td>17.2789</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>时间</th>\n",
       "      <td>2025-10-09 15:29:52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>今开</th>\n",
       "      <td>11.7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                        value\n",
       "item                         \n",
       "代码                   06823.HK\n",
       "52周最高                   12.95\n",
       "流通股                7579776147\n",
       "最高                      11.78\n",
       "流通值             88986571966.0\n",
       "最小交易单位                   1000\n",
       "涨跌                       0.12\n",
       "每股收益                   0.6794\n",
       "昨收                      11.62\n",
       "成交量                   3184849\n",
       "周转率                      0.04\n",
       "52周最低                    9.39\n",
       "名称                    香港电讯-SS\n",
       "交易所                        HK\n",
       "市盈率(动)                21.4943\n",
       "基金份额/总股本           7579776147\n",
       "均价                    11.7239\n",
       "涨幅                       1.03\n",
       "市销率                     2.568\n",
       "振幅                       1.72\n",
       "现价                      11.74\n",
       "今年以来涨幅                  30.82\n",
       "发行日期      2011-11-29 00:00:00\n",
       "最低                      11.58\n",
       "资产净值/总市值        88986571966.0\n",
       "股息(TTM)                 0.797\n",
       "股息率(TTM)                 6.79\n",
       "货币                        HKD\n",
       "每股净资产                  4.7895\n",
       "市盈率(静)                17.5516\n",
       "成交额               37328296.29\n",
       "市净率                    2.4512\n",
       "市盈率(TTM)              17.2789\n",
       "时间        2025-10-09 15:29:52\n",
       "今开                       11.7"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "7eac5e0b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>item</th>\n",
       "      <th>代码</th>\n",
       "      <th>名称</th>\n",
       "      <th>现价</th>\n",
       "      <th>52周最低</th>\n",
       "      <th>52周最高</th>\n",
       "      <th>成交量</th>\n",
       "      <th>股息率(TTM)</th>\n",
       "      <th>股息(TTM)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>value</th>\n",
       "      <td>06823</td>\n",
       "      <td>香港电讯-SS</td>\n",
       "      <td>11.75</td>\n",
       "      <td>9.39</td>\n",
       "      <td>12.95</td>\n",
       "      <td>3017448</td>\n",
       "      <td>6.78</td>\n",
       "      <td>0.797</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "item      代码       名称     现价 52周最低  52周最高      成交量 股息率(TTM) 股息(TTM)\n",
       "value  06823  香港电讯-SS  11.75  9.39  12.95  3017448     6.78   0.797"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.T[[\"代码\", \"名称\", \"现价\", \"52周最低\", \"52周最高\", \"成交量\", \"股息率(TTM)\", \"股息(TTM)\"]]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "openbb-hka",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
